// 菜单管理相关接口
import request from '@/utils/request'

import type { IMenuAssignData, IMenuByRoleResponseData } from './type'
import type { ResponseData } from '@/types/common'

enum API {
  MENU_BY_ROLE_URL = '/admin/acl/permission/toAssign',
  MENU_ASSIGN_URL = '/admin/acl/permission/doAssignAcl',
}

// 获取角色已分配菜单接口
export const reqMenuByRole = (data: number) => {
  return request.get<any, IMenuByRoleResponseData>(
    API.MENU_BY_ROLE_URL + `/${data}`,
  )
}

// 角色分配菜单接口
export const reqMenuAssign = (data: IMenuAssignData) => {
  return request.post<any, ResponseData>(API.MENU_ASSIGN_URL, data)
}
